// pages/login/login.js
Page({
 
  /**
   * 页面的初始数据
   */
  data: {
    userName:'',
    passWord:''
  },
  submit:function(e){
    console.log(e.detail.value);
    //表单数据
    var objData = e.detail.value;
    if (objData.userName && objData.passWord){
      //异步方式储存表单数据
      wx.setStorage({
        key: 'userName',
        data: objData.userName,
      })
      wx.setStorage({
        key: 'passWord',
        data: objData.passWord,
      })
      wx.navigateTo({
        url: '../ceshi1/ceshi1',
      })
    }
   
  },
  onLoad: function (options) {
    var that = this
    wx.getStorage({
      key: 'userName',
      success: function(res) {
        that.setData({ userName: res.data })
      },
    })
    wx.getStorage({
      key: 'passWord',
      success: function (res) {
        console.log(res.data)
        that.setData({ passWord: res.data })
      },
    })
  },

})
